﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLNS_Public;
using System.Data;

namespace QLNS_Data
{
   public class ChamCong_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();


       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_tbl_ChamCong");
       }
       public DataTable taobang(string sql)
       {
           return kn.taobang(sql);
       }
       public int update_ChamCong(ChamCong_Public maCong,ChamCong_Public maNhanVien,ChamCong_Public thang,ChamCong_Public nam,ChamCong_Public ngayNghiCoPhep,ChamCong_Public ngayNghiKhongPhep)
       {
           int n = 6;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaCong";
           value[0] = maCong.MaCong;
           name[1] = "@MaNhanVien";
           value[1] = maNhanVien.MaNhanVien;
           name[2] = "@Thang";
           value[2] = thang.Thang;
           name[3] = "@Nam";
           value[3] = nam.Nam;
           name[4] = "@NgayNghiCoPhep";
           value[4] = ngayNghiCoPhep.NgayNghiCoPhep;
           name[5] = "@NgayNghiKhongPhep";
           value[5] = ngayNghiKhongPhep.NgayNghiKhongPhep;
           return kn.update("Update_ChamCong",name,value,n);
       }
       public int insert_ChamCong(ChamCong_Public maNhanVien, ChamCong_Public thang, ChamCong_Public nam, ChamCong_Public ngayNghiCoPhep, ChamCong_Public ngayNghiKhongPhep)
       {
           int n = 5;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaNhanVien";
           value[0] = maNhanVien.MaNhanVien;
           name[1] = "@Thang";
           value[1] = thang.Thang;
           name[2] = "@Nam";
           value[2] = nam.Nam;
           name[3] = "@NgayNghiCoPhep";
           value[3] = ngayNghiCoPhep.NgayNghiCoPhep;
           name[4] = "@NgayNghiKhongPhep";
           value[4] = ngayNghiKhongPhep.NgayNghiKhongPhep;
           return kn.update("Insert_ChamCong", name, value, n);
       }
       public int delete_ChamCong(ChamCong_Public maCong)
       {
           int n = 1;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaCong";
           value[0] = maCong.MaCong;
           return kn.update("Delete_ChamCong", name, value, n);
       }
    }
}
